import { ref } from 'vue'

export function useError() {
  const error = ref(null)

  const setError = (err) => {
    error.value = err
  }

  const clearError = () => {
    error.value = null
  }

  return {
    error,
    setError,
    clearError
  }
}
